﻿<Window x:Class="Pulse.Options"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Properties="clr-namespace:Pulse.Properties"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="{x:Static Properties:Resources.OptionsWindowTitle}" Height="480" Width="520" WindowStartupLocation="CenterScreen" MinWidth="400" MinHeight="350"
        SourceInitialized="WindowSourceInitialized">
    <DockPanel Background="{StaticResource TabControlBgBrush}" Margin="0,34,0,0">
        <Grid DockPanel.Dock="Bottom">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,10">
                <Button Name="OkButton" Content="{x:Static Properties:Resources.OptionsOkButton}" MinWidth="75" Height="23" Margin="0,0,7,0" Click="OkButtonClick"/>
                <Button Name="CancelButton" Content="{x:Static Properties:Resources.OptionsCancelButton}" MinWidth="75" Height="23" Margin="0,0,7,0" Click="CancelButtonClick"/>
                <Button Name="ApplyButton" Content="{x:Static Properties:Resources.OptionsApplyButton}" MinWidth="75" Height="23" Margin="0,0,7,0" IsEnabled="False" Click="ApplyButtonClick"/>
            </StackPanel>
        </Grid>
        <TabControl Style="{StaticResource TabControlStyle}" Margin="0,-34,0,0">
            <TabItem Header="{x:Static Properties:Resources.OptionsGeneralTabHeader}" Style="{StaticResource TabItemStyle}">
                <ScrollViewer VerticalScrollBarVisibility="Auto" Background="White">
                    <StackPanel Orientation="Vertical" Margin="10">
                        <TextBlock FontSize="24" FontWeight="Light" Text="{x:Static Properties:Resources.OptionsSearch}" Foreground="#083ca2"/>
                        <Separator Margin="0,0,0,10"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBox Name="SearchBox" FontStyle="Italic" Foreground="Gray"
                                     IsKeyboardFocusedChanged="SearchBoxIsKeyboardFocusedChanged" TextChanged="SearchBoxTextChanged" Width="183" />
                            <ComboBox Name="ProvidersBox" MinWidth="120" Margin="7,3,0,3" SelectionChanged="ProviderSelectionChanged" Width="156" />
                            <Button Content="{x:Static Properties:Resources.ProviderSettings}" Height="23" Name="ProviderSettings" Width="75" IsEnabled="False" Margin="7,0,0,0" Click="ProviderSettings_Click" />
                        </StackPanel>
                        <TextBlock FontSize="24" FontWeight="Light" Text="{x:Static Properties:Resources.OptionsBehaviour}" Margin="0,15,0,0" Foreground="#083ca2"/>
                        <Separator Margin="0,0,0,10"/>

                        <CheckBox Name="AutoDownloadCheckBox" Content="{x:Static Properties:Resources.OptionsDownloadAutomatically}" Click="CheckBoxClick"/>
                        <CheckBox Name="DownloadOnStartCheckBox" Content="{x:Static Properties:Resources.OptionsDownloadOnStart}" Click="CheckBoxClick"/>

                        <StackPanel Orientation="Horizontal" Margin="0,7,0,0" >
                            <TextBlock Text="{x:Static Properties:Resources.OptionsRefreshInterval}"/>
                            <TextBlock Name="RefreshIntervalValueTextBlock" Text="20 min." Margin="5,0,3,0" FontWeight="DemiBold"/>
                        </StackPanel>
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Left" Text="{x:Static Properties:Resources.OptionsLessUpdates}" Margin="0,0,7,0" VerticalAlignment="Center" Foreground="Gray"/>
                            <TextBlock DockPanel.Dock="Right" Text="{x:Static Properties:Resources.OptionsMoreUpdates}" Margin="7,0,0,0" VerticalAlignment="Center" Foreground="Gray"/>
                            <Slider Name="RefreshIntervalSlider" Margin="0,3,0,0" Value="20" TickPlacement="Both" Minimum="0" Maximum="90" TickFrequency="5" SmallChange="10" LargeChange="10"
                                        IsSnapToTickEnabled="True" IsDirectionReversed="True" ValueChanged="RefreshIntervalSliderValueChanged" IsEnabled="{Binding ElementName=AutoDownloadCheckBox, Path=IsChecked}"/>
                        </DockPanel>
                        <CheckBox Name="PreFetchCheckBox" Content="{x:Static Properties:Resources.OptionsPreFetch}" Click="CheckBoxClick"/>
                        <TextBlock FontSize="24" FontWeight="Light" Text="{x:Static Properties:Resources.OptionsCache}" Margin="0,15,0,0" Foreground="#083ca2"/>
                        <Separator Margin="0,0,0,10"/>
                        <CheckBox Name="ClearCacheCheckBox" Content="{x:Static Properties:Resources.OptionsClearCache}" Click="CheckBoxClick"/>
                        <TextBlock Name="ClearIntervalTextBlock" Text="{x:Static Properties:Resources.OptionsClearInterval}"  Margin="0,7,0,0"/>
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Left" Text="{x:Static Properties:Resources.OptionsOlder}" Margin="0,0,7,0" VerticalAlignment="Center" Foreground="Gray"/>
                            <TextBlock DockPanel.Dock="Right" Text="{x:Static Properties:Resources.OptionsNewer}" Margin="7,0,0,0" VerticalAlignment="Center" Foreground="Gray"/>
                            <Slider Name="ClearIntervalSlider" Margin="0,3,0,0" Value="20" TickPlacement="Both" Minimum="1" Maximum="12" TickFrequency="1" SmallChange="1" LargeChange="4"
                                        IsSnapToTickEnabled="True" IsDirectionReversed="True" ValueChanged="ClearIntervalSliderValueChanged" IsEnabled="{Binding ElementName=ClearCacheCheckBox, Path=IsChecked}"/>
                        </DockPanel>
                        <Button Name="ClearNowButton" Content="{x:Static Properties:Resources.OptionsClearNow}" Padding="10,0,10,0" Height="23" HorizontalAlignment="Right" Margin="0,7,0,0" Click="ClearNowButtonClick"/>
                        <TextBlock FontSize="24" FontWeight="Light" Text="{x:Static Properties:Resources.OptionsLanguage}" Margin="0,-7,0,0" Foreground="#083ca2"/>
                        <Separator Margin="0,0,0,10"/>
                        <ComboBox Name="LanguageComboBox" SelectionChanged="ComboBoxSelectionChanged"/>
                        <TextBlock Text="{x:Static Properties:Resources.OptionsRestart}" Margin="0,3,0,0" Foreground="Gray"/>
                    </StackPanel>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="Outputs" Style="{StaticResource TabItemStyle}">
                <ScrollViewer VerticalScrollBarVisibility="Auto" Background="White">
                    <StackPanel Orientation="Vertical" Margin="10">
                        <TextBlock FontSize="24" FontWeight="Light" Foreground="#083ca2" Text="{x:Static Properties:Resources.OptionsOutputs}" />
                        <Separator />

                        <ListView ItemsSource="{Binding OutputProviderInfos}">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Header="Active">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox IsChecked="{Binding Active}" Checked="OutputProvidersCheckBox_Click" Unchecked="OutputProvidersCheckBox_Click" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Name" DisplayMemberBinding="{Binding ProviderName}"/>
                                    <GridViewColumn Header="Order">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding Order}" Width="20" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Allow Async">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox IsChecked="{Binding AsyncOK}" Checked="OutputProvidersCheckBox_Click" Unchecked="OutputProvidersCheckBox_Click" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Settings">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button IsEnabled="{Binding IsConfigurable}" Content="Configure" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </StackPanel>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="{x:Static Properties:Resources.OptionsAboutTabHeader}" Style="{StaticResource TabItemStyle}">
                <ScrollViewer VerticalScrollBarVisibility="Auto" Background="White">
                    <StackPanel Orientation="Vertical" Margin="10">
                        <Grid>
                            <Image Width="55" Source="/Resources/logo.png" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,40,10,0" Opacity="1"/>
                            <StackPanel Orientation="Vertical">
                                <TextBlock FontSize="24" FontWeight="Light" Text="{x:Static Properties:Resources.OptionsAbout}" Foreground="#083ca2"/>
                                <Separator/>
                                <TextBlock Text="Pulse Beta 4" Margin="0,7,0,0"/>
                                <TextBlock>
                                    <Run Text="{x:Static Properties:Resources.OptionsVersion}"/> 
                                    <Run Name="BuildTag" Text="1.0.0.0"/>
                                </TextBlock>
                                <TextBlock Text="Copyright © Stealth 2011, Patricker 2012"/>
                                <TextBlock Text="{x:Static Properties:Resources.OptionsCopyright}" TextWrapping="Wrap"/>
                            </StackPanel>
                        </Grid>
                    </StackPanel>
                </ScrollViewer>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
